package com.ymttest.database.sharding.config;

import com.ymttest.utils.EnvSetup;

public class ConnectionConfig {

	private static ConnectionConfig config = null;

	private ConnectionConfig() {

		setExtDbUrl(EnvSetup.getSystemUrl("ext.dbUrl"));
		setExtDbUser(EnvSetup.getSystemUrl("ext.dbUser"));
		setExtDbPassword(EnvSetup.getSystemUrl("ext.dbPassword"));

		setShardingDbUrl(EnvSetup.getSystemUrl("sharding.dbUrl"));
		setShardingDbUser(EnvSetup.getSystemUrl("sharding.dbUser"));
		setShardingDbPassword(EnvSetup.getSystemUrl("sharding.dbPassword"));
		setShardingDbCount(Integer.valueOf(EnvSetup
				.getSystemUrl("sharding.dbCount")));
		setShardingDbPort(Integer.valueOf(EnvSetup
				.getSystemUrl("sharding.dbPort")));

	}
	private String extDbUrl;

	private String extDbUser;

	private String extDbPassword;

	private String shardingDbUrl;

	private String shardingDbUser;

	private String shardingDbPassword;

	private int shardingDbCount;

	private int shardingDbPort;

	public String getExtDbUrl() {
		return extDbUrl;
	}

	public void setExtDbUrl(String extDbUrl) {
		this.extDbUrl = extDbUrl;
	}

	public String getExtDbUser() {
		return extDbUser;
	}

	public void setExtDbUser(String extDbUser) {
		this.extDbUser = extDbUser;
	}

	public String getExtDbPassword() {
		return extDbPassword;
	}

	public void setExtDbPassword(String extDbPassword) {
		this.extDbPassword = extDbPassword;
	}

	public String getShardingDbUrl() {
		return shardingDbUrl;
	}

	public void setShardingDbUrl(String shardingDbUrl) {
		this.shardingDbUrl = shardingDbUrl;
	}

	public String getShardingDbUser() {
		return shardingDbUser;
	}

	public void setShardingDbUser(String shardingDbUser) {
		this.shardingDbUser = shardingDbUser;
	}

	public String getShardingDbPassword() {
		return shardingDbPassword;
	}

	public void setShardingDbPassword(String shardingDbPassword) {
		this.shardingDbPassword = shardingDbPassword;
	}

	public int getShardingDbCount() {
		return shardingDbCount;
	}

	public void setShardingDbCount(int shardingDbCount) {
		this.shardingDbCount = shardingDbCount;
	}

	public int getShardingDbPort() {
		return shardingDbPort;
	}

	public void setShardingDbPort(int shardingDbPort) {
		this.shardingDbPort = shardingDbPort;
	}

	public static ConnectionConfig getInstance() {

		if (config == null) {
			config = new ConnectionConfig();
		}
		return config;
	}

}
